<template>
  <router-link
    :to="{name: 'classDetail',query: {packageId: item.Id, title: item.Name,
                                      img: item.ShowCoverUrl}}"
    tag="div"
    class="class-item"
  >
    <div class="left">
      <img
        v-lazy="item.ShowCoverUrl"
        class="class-img"
      >
    </div>
    <div class="right">
      <div class="class-name">
        {{ item.Name }}
      </div>
      <div class="eroll-time">
        套餐介绍：{{ item.Description }}
      </div>
      <div class="btn-restime">
        <van-button
          class="btn-study"
          size="small"
        >
          立即学习
        </van-button>
        <!-- <van-button
          v-if="item.OrderStatus === 1"
          class="btn-pay"
          size="small"
          @click.stop="onPay(item.OrderId, item.OrderNumber)"
        >
          立即支付
        </van-button>
        <div
          v-show="item.OrderStatus === 1"
          class="countdown"
        >
          <CountDown
            :diff-time="+item.OrderRestTime"
            :interval-time="30"
            class="order-restime"
            @timeEnded="onTimeEnded"
          >
            <template slot-scope="{cd}">
              剩余{{ cd.hour }}时{{ cd.minute }}分
            </template>
          </CountDown>
        </div> -->
      </div>
    </div>
  </router-link>
</template>
<script lang="ts">
import Vue from 'vue'
import { SET_PAYINFO } from '@/store/mutations'
export default Vue.extend({
  components: {
    // CountDown: () => import('components/Class/CountDown.vue'),
  },
  props: {
    item: {
      default: () => ({}),
      type: Object,
    },
  },
  methods: {
    onTimeEnded (item : boolean) {
      this.$emit('IsTimeEnd', item)
    },
    // 去付款
    onPay (orderId: string, orderNumber: string) {
      this.$router.push({ name: 'pay', query: { orderId, orderNumber } })
    },
  },
})
</script>

<style lang="scss" scoped>
@import "~scss/class/register.scss";
</style>
